package com.jiazhong.shixi.diancan_xitong.controller;

import com.jiazhong.shixi.diancan_xitong.bean.Menu;
import com.jiazhong.shixi.diancan_xitong.mapper.MenuMapper;
import com.jiazhong.shixi.diancan_xitong.util.JsonResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
@CrossOrigin("*")
@RequestMapping("/menu")
@RestController
public class    MenuController {

    @Resource
    private MenuMapper menuMapper;
    @RequestMapping("/find_menu")
    public JsonResult findByMenu(){
        List<Menu> list = menuMapper.findByMenu();
        JsonResult result = new JsonResult(true,200,list,"");
        return result;

    }
    @RequestMapping("/add")
    public JsonResult add(Menu menu){
        menuMapper.add(menu);
        JsonResult result = new JsonResult(true,200,"","");
        return result;
    }
    @RequestMapping("/update")
    public JsonResult update(Menu menu){
        menuMapper.update(menu);
        JsonResult result = new JsonResult(true,200,"","");
        return result;
    }


}
